<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="box" id="box" name="box" data-id="123">
    <span id="son2">333</span>
    <span id="son">123</span>
  </div>
</body>
</html>

<script>
const box = document.querySelector('.box');
const son = document.querySelector('#son');

// 克隆节点：
  // dom.cloneNode()  -> 克隆自身节点
  // dom.cloneNode(true)  ->  克隆自身及其所有后代节点

const cloneBox = box.cloneNode();

console.log(cloneBox, box.cloneNode(true));



</script>
